﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;

namespace Marmat.Forms.Skin
{
    partial class CardPanel
    {

        /// <summary>
        /// 获取或设置SkinCard的标题外边距
        /// </summary>
        [Category("样式"), Description("获取或设置SkinCard的标题外边距")]
        [DefaultValue(5)]
        public int TitleMargin
        {
            get => _titleMargin;
            set
            {
                value = Math.Max(value, 0);
                if (this._titleMargin != value)
                {
                    this._titleMargin = value;
                    this.UpdateStyles();
                }
            }
        }
        private int _titleMargin = 5;

        /// <summary>
        /// 与控件关联的文本
        /// </summary>
        [Category("样式"), Description("与控件关联的文本")]
        [DefaultValue(null)]
        [Browsable(true)]
        [EditorBrowsable(EditorBrowsableState.Always)]
        public override string Text
        {
            get => this._text;
            set
            {
                this._text = value;
                this.UpdateStyles();
            }
        }
        private string _text;

        /// <summary>
        /// 获取或设置 隐藏标题
        /// </summary>
        [Category("样式"), Description("获取或设置 隐藏标题")]
        [DefaultValue(false)]
        public bool HideTitle
        {
            get => this._hideTitle;
            set
            {
                this._hideTitle = value;
                this.UpdateStyles();
            }
        }
        private bool _hideTitle;

        /// <summary>
        /// 获取或设置SkinCard的边框颜色
        /// </summary>
        [Category("样式"), Description("获取或设置SkinCard的边框颜色")]
        [DefaultValue(typeof(Color), "48, 49, 51")]
        public Color BorderColor
        {
            get => _borderColor;
            set
            {
                this._borderColor = value;
                this.UpdateStyles();
            }
        }
        private Color _borderColor = Configuration.DefaultTheme.SecondaryText;


        /// <summary>
        /// 获取或设置控件显示的文字的字体。
        /// </summary>
        public override Font Font
        {
            get => _font;
            set
            {
                this._font = value;
                this.UpdateStyles();
            }
        }
        private Font _font = new Font("微软雅黑", 9F, FontStyle.Regular);

        /// <summary>
        /// 获取 SkinCard 中的操作按钮
        /// </summary>
        [Category("数据"), Description("SkinCard 中的操作按钮")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public CardPanelCollection Buttons { get; }

        //储存矩形
        private Dictionary<CardPanelItem, Rectangle> rectangleDec = new Dictionary<CardPanelItem, Rectangle>();
        //鼠标位置
        private Point point = new Point(-1, -1);
        //点击的按钮
        private CardPanelItem clickItem;
    }
}
